#include "thread.h"
#include<QMutex>
#include<QReadWriteLock>
int num=0;
//QMutex mutex;
QReadWriteLock rwLock;
Thread::Thread()
{}

Thread::~Thread()
{

}


//小方讨论：并发加锁，但只有一个解锁
void Thread::run()
{
    for(int i=0;i<10000;i++)
    {
        mutex.lock();
        //rwLock.lockForWrite();
        num++;
      //  rwLock.unlock();
        mutex.unlock();//没有这个会死锁    自己出不去，别人进不来
    }


}
